package year2019.month0234;

import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;

/**
 * @desc 描述
 * create on 2019/4/25 by watson
 */
public class TestListIterator {

    public static void main(String[] args){
        List<String> strList = new ArrayList<>();
        strList.add("一");
        strList.add("二");
        strList.add("三");
        strList.add("四");
        strList.add("五");

        ListIterator<String> strListIt1 = strList.listIterator();
        while (strListIt1.hasNext()){
            System.out.println(strListIt1.next()+"\t"+strListIt1.nextIndex());
        }
        System.out.println();

        ListIterator<String> strListIt2 = strList.listIterator();
        while (strListIt2.hasNext()){
            System.out.println(strListIt2.nextIndex()+"\t"+strListIt2.next());
        }
        System.out.println();

    }

}
